package com.example.aixiangshou.runninggame;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ProgressBar;

import com.x_memteor.base_master.base.BaseActivity;

import butterknife.BindView;

public class Main2Activity extends BaseActivity {

    @BindView(R.id.pb_load)
    ProgressBar pbLoad;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void initRootView() {
        setContentView(R.layout.activity_main2);
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {
        new Thread() {
            @Override
            public void run() {
                int i = 0;
                while (i < 100) {
                    i++;
                    try {
                        Thread.sleep(50);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    final int j = i;
                    pbLoad.setProgress(i);
                }
                if (i >= 100) {
                    jumpTo();
                }
            }
        }.start();
    }

    @Override
    public void initListener() {

    }
    private void jumpTo(){
        Intent intent = new Intent(this, WelcomeActivity.class);
        startActivity(intent);
        finish();
    }
}
